<template>
  <view class="container">
    <view class="common_cell common_cell2">
      <u-cell isLink @click="toUserSettint" v-if="userInfo.id">
        <view slot="icon" class="u-cell-left">
          <u-avatar :src="userInfo.avatarUrl"></u-avatar>
          <text>{{ userInfo.nickName || "微信用户" }}</text>
        </view>
      </u-cell>

      <u-cell isLink @click="toLogin" v-else>
        <view slot="icon" class="u-cell-left">
          <u-avatar :src="userInfo.avatarUrl"></u-avatar>
          <text>去登陆</text>
        </view>
      </u-cell>
    </view>

    <view class="common_cell common_cell2">
      <u-cell isLink @click="toMoney">
        <view slot="icon" class="u-cell-left">
          <img src="@/static/me/qbzc.png" alt="" srcset="" />
          <text>钱包充值</text>
        </view>
      </u-cell>
    </view>

    <view class="common_cell common_cell2">
      <u-cell isLink @click="toMyOrder">
        <view slot="icon" class="u-cell-left">
          <img src="@/static/me/wddd.png" alt="" srcset="" />
          <text>我的订单</text>
        </view>
      </u-cell>
    </view>

    <view class="common_cell common_cell2" @click="toWarning">
      <u-cell isLink>
        <view slot="icon" class="u-cell-left">
          <img src="@/static/me/bjjl.png" alt="" srcset="" />
          <text>报警记录</text>
        </view>
      </u-cell>
    </view>

    <view class="common_cell common_cell2">
      <u-cell-group>
        <u-cell :border="false" isLink @click="toHelpPage">
          <view slot="icon" class="u-cell-left">
            <img src="@/static/me/bzzx.png" alt="" srcset="" />
            <text>帮助中心</text>
          </view>
        </u-cell>
        <u-cell :border="false" isLink>
          <view slot="icon" class="u-cell-left">
            <img src="@/static/me/lxkf.png" alt="" srcset="" />
            <text>联系客服</text>
          </view>
        </u-cell>
        <u-cell :border="false" isLink @click="toPrivacyPage">
          <view slot="icon" class="u-cell-left">
            <img src="@/static/me/ysbhsm.png" alt="" srcset="" />
            <text>隐私保护说明</text>
          </view>
        </u-cell>
        <u-cell :border="false" isLink @click="toFranchise">
          <view slot="icon" class="u-cell-left">
            <img src="@/static/me/jm.png" alt="" srcset="" />
            <text>代理商加盟</text>
          </view>
        </u-cell>
        <u-cell :border="false" isLink @click="toAboutPage">
          <view slot="icon" class="u-cell-left">
            <img src="@/static/me/gywm.png" alt="" srcset="" />
            <text>关于我们</text>
          </view>
        </u-cell>
      </u-cell-group>
    </view>
  </view>
</template>

<script>
export default {
  components: {},
  // 接受父组件传递的参数
  props: {
    userInfo: {
      type: Object,
      default: () => { },
    },
  },
  data() {
    return {
      // 页面参数
      options: {},
    };
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) { },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() { },

  methods: {
    toMoney() {
      // uni.navigateTo({
      //   url: "/pages/me/money/index",
      // });
      uni.navigateTo({
        url: `/pages/index/recharge/index?type=2`,
      });
    },
    toMyOrder() {
      uni.navigateTo({
        url: "/pages/me/order/index",
      });
    },
    toWarning() {
      uni.navigateTo({
        url: "/pages/me/warning/index",
      });
    },
    toUserSettint() {
      uni.navigateTo({
        url: "/pages/me/config/index",
      });
    },
    toLogin() {
      uni.navigateTo({
        url: "/pages/login/index",
      });
    },
    toFranchise() {
      uni.navigateTo({
        url: "/pages/me/franchise/index",
      });
    },
    // 去帮助中心
    toHelpPage() {
      uni.navigateTo({
        url: "/pages/me/help/index",
      });
    },
    // 去关于我们
    toAboutPage() {
      uni.navigateTo({
        url: "/pages/me/about/index",
      });
    },
    // 去隐私政策
    toPrivacyPage() {
      uni.navigateTo({
        url: "/pages/me/privacy/index",
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.container {
  background: #f6f7fb;

  padding: 61.364rpx 39.205rpx 39.205rpx 39.205rpx;
}

.u-cell-left {
  display: flex;
  align-items: center;

  img {
    width: 37.5rpx;
    height: 37.5rpx;
  }

  text {
    margin-left: 34.091rpx;
  }
}

.common_cell {
  background: #fff !important;

  border-radius: 17.045rpx;
  margin-top: 18.75rpx;
  padding-left: 34.091rpx;
  padding-right: 34.091rpx;

  ::v-deep .u-cell__body {
    padding-top: 35.795rpx !important;
  }
}
</style>
